// 盛最多水的容器
#include<iostream>
#include<vector>


using namespace std;

class Solution{
public:
    int maxAera(vector<int> & height){
        
        int result = 0;
        int left = 0;
        int right = height.size() - 1;

        while(left < right){
            int h = min(height[left], height[right]);
            int area = h * (right - left);
            // 比较最大面积
            result = max(result, area);
            if (height[left] <= height[right]){
                left ++;
            }else{
                right --;
            }
        }
        return result;

    }

};



int main(){

    vector<int> height = {1,8,6,2,5,4,8,3,7};
    int result;
    Solution solution;

    result = solution.maxAera(height);
    cout << result << endl;

    return 0;
}
